﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Cips.DataMining.Tests
{
    [TestClass]
    public class TermDictionaryTests
    {
        [TestMethod]
        public void TermDictionaryShouldMapUniquely()
        {
            var dictionary = new TermDictionary<string>();

            Assert.AreEqual(0, dictionary["test"]);
            Assert.AreEqual(1, dictionary["second"]);
            Assert.AreEqual(0, dictionary["test"]);
        }

        [TestMethod]
        public void TermDictionaryShouldDoRoundTrip()
        {
            var dictionary = new TermDictionary<string>();

            Assert.AreEqual(0, dictionary["test"]);
            Assert.AreEqual(1, dictionary["second"]);
            Assert.AreEqual("test", dictionary[0]);
            Assert.AreEqual("second", dictionary[1]);
        }

        [TestMethod]
        [ExpectedException(typeof(ArgumentNullException))]
        public void TermDictionaryCannotStoreNull()
        {
            var dictionary = new TermDictionary<string>();

            var ignore = dictionary[null];
        }
    }
}
